<form id="info_form" class="form-horizontal">
    {{ csrf_field() }}
    <div class="box-body">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">菜单名称</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                    <input type="text" id="title" name="title" value="{{$menu->title}}"
                           class="form-control">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">上级菜单</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <span class="input-group-addon"><i class="fa fa-bars"></i></span>
                    <select name="parent_id" class="form-control" style="width: 200px;">
                        <option value="0">请选择上级菜单</option>
                        @foreach($pmenus as $m)
                            <option value="{{$m->id}}"
                                    @if($m->id == $menu->parent_id)selected="selected"@endif>{{$m->title}}</option>
                        @endforeach
                    </select>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">菜单链接</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                    <input type="text" id="uri" name="uri" value="{{$menu->uri}}"
                           class="form-control" placeholder="如：/admin/users">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">菜单icon</label>
            <div class="col-sm-8">
                <div class="input-group iconpicker-container">
                    <span class="input-group-addon icon-class-show"><i class="@if($menu->icon){{$menu->icon}}@else{{'fa fa-bars'}}@endif"></i></span>
                    <input type="text" id="icon" name="icon" value="@if($menu->icon){{$menu->icon}}@else{{'fa fa-bars'}}@endif"
                           class="form-control icon">
                </div>
                @include('admin.auth.common.icon')
            </div>
        </div>
    </div>
    <div class="box-footer">
        <div class="col-sm-2"></div>
        <div class="col-sm-8">
            <div class="btn-group pull-left">
                <button type="reset" class="btn btn-info btn-sm">重置
                </button>
            </div>
            <div class="btn-group pull-right">
                <input type="hidden" name="id" value="{{$menu->id}}">
                <input class="btn btn-primary btn-sm" type="button" onclick="save()" value="保存">
            </div>
        </div>
    </div>
</form>
<script>
    $(function () {
        $('.icon').click(function(){
            $('#icon_modal').modal();
        });
    });

    function save() {
        nform.submit('info_form', '{{route('admin-menu-save')}}', function () {
            goUrl('{{route('admin-menus')}}')
        });
    }
</script>